//
//  CofirmOrder_Section_Fv.swift
//  MikerShop
//
//  Created by eme on 2016/12/24.
//  Copyright © 2016年 eme. All rights reserved.
//

/*
 owner:cy
 update:2016年12月24日10:57:31
 info: 确认订单  显示发货公司 小计，以及填写您的留言
 VC :  CofirmOrder_Vc
 */
import UIKit
import Kingfisher
import RxSwift
import UtilCore

class CofirmOrder_Fv: UITableViewCell {
    
    ///共计商品
    @IBOutlet weak var editnum_Lb: UILabel!
    
    ///总运费
    @IBOutlet weak var ordertotalposttag_Lb: UILabel!
    
    ///包含运费的价格
    @IBOutlet weak var subtotal_Lb: UILabel!
    
    /// 店铺留言
    @IBOutlet weak var pdcode_Tv: PlaceholderTextView!
    
    var update_Closure:((Void)-> Void)?
    
    var item :OrderProductModel?{
        didSet{
            if let item = self.item {
                self.editnum_Lb.text = "共计\(item.editnum)件商品,小计:"
                self.ordertotalposttag_Lb.text = "(\(item.show_pdsendtype))"
                self.subtotal_Lb.text = item.subtotal.getPriceStr()
                self.pdcode_Tv.text = item.message

            }
        }
    }
    
    override func awakeFromNib() {
        
        self.pdcode_Tv.delegate = self
        self.pdcode_Tv.changeBorderColor(UIColor(hex: "979797"), cornerRadius: 1)
    }
}
extension CofirmOrder_Fv : UITextViewDelegate{
    
    func textViewDidEndEditing(_ textView: UITextView) {
        let text = textView.text
        if text!.characters.count > 100 {
            showMsg(100041003)
        }
        self.item?.message = text!
        if  let update_Closure = self.update_Closure {
            update_Closure()
        }
    }
}
